<?php
/*
 * 中间件
 */
use App\Middlewares;
/*
 * 用户登录
 */
$app -> get('/', 'App\Controllers\UserController:Login');
// 处理带有斜线结尾的URL 和不带斜线的URL 的方式不同
$app -> add('App\Middlewares\TrailingSlashMiddleware');
$app -> get('/home', 'App\Controllers\UserController:welcome');
$app -> post('/menu', 'App\Controllers\PowerController:Menu');
$app -> get('/login', 'App\Controllers\UserController:Login') -> setname('Login');
$app -> post('/login', 'App\Controllers\UserController:postLogin');
$app -> get('/logout', 'App\Controllers\UserController:Logout') -> setname('Logout');
$app -> get('/405', 'App\Controllers\UserController:Error') -> setname('Error');
$app -> get('/password/select', 'App\Controllers\UserController:selectPsw');
$app -> post('/password/select', 'App\Controllers\UserController:PswSelect');
$app -> group('', function() {
	$this -> post('/user/img', 'App\Controllers\UserController:UserImg');
	$this -> get('/user/list', 'App\Controllers\UserController:UserList');
	$this -> get('/user/data', 'App\Controllers\UserController:getData');
	$this -> get('/user/show', 'App\Controllers\UserController:UserShow') -> setname('Self');
	$this -> get('/user/self', 'App\Controllers\UserController:getSelf');
	$this -> get('/user/add', 'App\Controllers\UserController:getAdd');
	$this -> post('/user/add', 'App\Controllers\UserController:UserAdd');
	$this -> get('/user/updata', 'App\Controllers\UserController:getUpdate');
	$this -> post('/user/updata', 'App\Controllers\UserController:UserUpdate');
	$this -> post('/user/delete', 'App\Controllers\UserController:UserDelete');
	$this -> get('/user/select', 'App\Controllers\UserController:UserSelect');
	$this -> get('/role/list', 'App\Controllers\RoleController:getRole');
	$this -> get('/role/show', 'App\Controllers\RoleController:RoleShow');
	$this -> post('/role/select', 'App\Controllers\RoleController:RoleSelect');
	$this -> get('/role/update', 'App\Controllers\RoleController:getUpdate');
	$this -> post('/role/update', 'App\Controllers\RoleController:RoleUpdate');
	$this -> get('/power/list', 'App\Controllers\PowerController:getPower');
	$this -> get('/power/select', 'App\Controllers\PowerController:PowerSelect');
	$this -> post('/power/add', 'App\Controllers\PowerController:PowerAdd');
	$this -> post('/power/getpower', 'App\Controllers\PowerController:PowerGet');
	$this -> get('/power/updata', 'App\Controllers\PowerController:getUpdata');
	$this -> post('/power/updata', 'App\Controllers\PowerController:PowerUpdata');
	$this -> get('/password/update', 'App\Controllers\UserController:getPsw');
	$this -> post('/password/update', 'App\Controllers\UserController:PswUpdate');

}) -> add(new App\Middlewares\RoleMiddleware($container)) -> add(new App\Middlewares\AuthMiddleware($container));
?>